home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / modules / nessus-2.2.8.mo / usr / sbin / uninstall-nessus < prev   
Text File  |  2006-06-13  |  3KB  |  159 lines

  1. #!/bin/sh
  2. #
  3. # uninstall-nessus
  4. #
  5. # Removes the previous configuration of Nessus
  6. #
  7. # Written by Renaud Deraison <deraison@cvs.nessus.org>
  8. #
  9. # This script is distributed under the Gnu General Public License (GPL)
  10. #
  11.  
  12. prefix=/usr
  13. exec_prefix=${prefix}
  14. bindir=${exec_prefix}/bin
  15. sbindir=${exec_prefix}/sbin
  16. libexecdir=${exec_prefix}/libexec
  17. datadir=/usr/share
  18. sysconfdir=/etc
  19. sharedstatedir=${prefix}/com
  20. localstatedir=/var/lib
  21. libdir=${exec_prefix}/lib
  22. includedir=${prefix}/include
  23. oldincludedir=/usr/include
  24. infodir=/usr/share/info
  25. mandir=/usr/share/man
  26.  
  27. test "$1" = "-q" && quiet=yes
  28.  
  29.  
  30. # check whether we have echo -n, depending
  31. # on the current shell, used
  32. case `echo -n` in
  33. \-n)    Xn=   ; Xc='\c' ;;
  34. *)      Xn=-n ; Xc=
  35. esac
  36.  
  37.  
  38. # make sure that we are root, if there is no id command,
  39. # you loose, anyway
  40. case `id 2>/dev/null` in 
  41. uid=0*) 
  42.     ;; 
  43. *)
  44.     echo "only root should use uninstall-nessus"
  45.     exit 1
  46. esac
  47.  
  48.  
  49. test -z "$quiet" && 
  50. {
  51. clear
  52.  
  53. echo "--------------------------------------------------------------------------------"
  54. echo "                          UN-INSTALLATION OF NESSUS"
  55. echo "--------------------------------------------------------------------------------"
  56.  
  57. echo
  58. echo
  59. echo "This script will de-install older versions Nessus from this system"
  60. echo
  61. echo
  62.  
  63.  
  64.  
  65. echo $Xn "Do you want to also delete your configuration files and keys ? (y/n) [n] " $Xc
  66. read answer < /dev/tty
  67. }
  68.  
  69.  
  70. test -z "$answer" && answer=n
  71.  
  72. test "$answer" = "y" && {
  73.  deleteall=y
  74.  echo "Do you want to delete the configurations of ALL nessus users on this "
  75.  echo $Xn "host ? (y/n) [y] " $Xc
  76.  read answer < /dev/tty
  77.  test "$answer" = "y" && 
  78.  {
  79.   deleteconfs=y
  80.  }
  81. }
  82.  
  83.  
  84. test -z "$quiet" && 
  85. {
  86. clear
  87. echo "--------------------------------------------------------------------------------"
  88. echo "                          UN-INSTALLATION OF NESSUS"
  89. echo "--------------------------------------------------------------------------------"
  90.  
  91. echo
  92. echo
  93. echo "We are now ready to uninstall Nessus from this system"
  94. test -n "$deleteall" && echo "All configuration files will be destroyed"
  95.  
  96. echo "Press a key to continue"
  97. read nothing < /dev/tty
  98. }
  99.  
  100. #
  101. # Step 2 - delete files
  102. #
  103. set -x
  104. rm -f  $bindir/nasl
  105. rm -f  $bindir/nasl-config
  106. rm -f  $bindir/nessus
  107. rm -f  $bindir/nessus-config
  108. rm -f  $bindir/nessus-build
  109. rm -f  $bindir/nessus-mkrand
  110. rm -f  $bindir/nessus-mkcert-client
  111.  
  112. rm -f  $sbindir/nessus-adduser
  113. rm -f  $sbindir/nessus-rmuser
  114. rm -f  $sbindir/nessusd
  115. rm -f  $sbindir/nessus-update-plugins
  116. rm -f  $sbindir/nessus-mkcert
  117. rm -f  $sbindir/nessus-check-signature
  118.  
  119. rm -rf $includedir/nessus
  120.  
  121. rm -f  $libdir/libhosts_gatherer.*
  122. rm -f  $libdir/libnasl.*
  123. rm -f  $libdir/libnessus.*
  124. rm -f  $libdir/libpcap-nessus.*
  125.  
  126. rm -rf $libdir/nessus
  127. rm -f  $mandir/man1/nasl-config.1
  128. rm -f  $mandir/man1/nasl.1
  129. rm -f  $mandir/man1/nessus-build.1
  130. rm -f  $mandir/man1/nessus-config.1
  131. rm -f  $mandir/man1/nessus.1
  132. rm -f  $mandir/man1/nessus-mkrand.1
  133. rm -f  $mandir/man1/nessus-mkcert-client.1
  134. rm -f  $mandir/man8/nessus-mkcert.8
  135.  
  136.  
  137. rm -f  $mandir/man8/nessus-adduser.8
  138. rm -f  $mandir/man8/nessus-rmuser.8
  139. rm -f  $mandir/man8/nessus-update-plugins.8
  140. rm -f  $mandir/man8/nessusd.8
  141.  
  142. test -n "$deleteall" && {
  143.  rm -rf $localstatedir/nessus
  144.  rm -rf $sysconfdir/nessus
  145.  test -n "$deleteconfs" &&
  146.  {
  147.   for i in `cat /etc/passwd | sed 's/.*:.*:.*:.*:.*:\(.*\):.*/\1/g'|sort|uniq`
  148.   do
  149.     test -f $i/.nessusrc && rm -f $i/.nessusrc
  150.   done
  151.  }
  152. }
  153.  
  154. set +x
  155.  
  156.  
  157. echo "Finished"
  158. rm -f $sbindir/uninstall-nessus
  159.